package pda.agenda;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import java.awt.Color;


public class ClickDay extends MouseAdapter{
	
	private AgendaView theView;
	private JLabel prevLbl = new JLabel();
	
	
	
	public ClickDay(AgendaView theView){
		this.theView = theView;
	}
	
	public void mouseClicked(MouseEvent mouseEvent){
		
		JLabel theLbl = (JLabel) mouseEvent.getSource();
		prevLbl.setBackground(Color.white);
		prevLbl = theLbl;
		String theDay = (theLbl.getText().length() > 2)? theView.aujourdhui.split("/")[0].split(" ")[1] : theLbl.getText()  ; 
		
		theView.setDateChoosenLbl(theDay,theView.getDateChoosenLbl().split("/")[1],theView.getDateChoosenLbl().split("/")[2]);
		
		theView.initHome();

		
		if (mouseEvent.getClickCount() == 2) {
				theView.setPanelActivity();
		}
	}
	
}
